use std::fs::File;
use std::io;
use std::io::BufRead;
use std::path::Path;

pub fn get_file_rows(path: &str, error_tips: &str) -> Result<Vec<String>, String> {
    let b_file_path = Path::new(&path);
    let b_res = File::open(&b_file_path);
    if let Err(error) = b_res {
        return Err(error_tips.to_string());
    }
    let b_reader = io::BufReader::new(b_res.unwrap());
    let mut all_position = Vec::new();
    // 读取文件中的每一行
    for b_line in b_reader.lines() {
        let b_line = b_line.unwrap_or(String::from(""));
        let b_parts: Vec<&str> = b_line.split(',').collect();
        if b_parts.len() > 2 {
            all_position.push(b_line);
        }
    }
    return Ok(all_position);
}
